<template>
	<view class="news news_wrapper">
		<view class="news_item" v-for="(item,index) in list" :key="item.id" @click="navigator(item)">
			<!-- <image src="https://img3m2.ddimg.cn/19/5/27860302-1_h_48.jpg"></image> -->
			<image src="https://img3m2.ddimg.cn/41/28/29461352-2_e_1689069077.jpg"></image>
			<view class="right">
				<view class="tit">{{item.title}}</view>
				<view class="info">
					<text>发表时间：{{item.add_time | formatDate}}</text>
					<text class="text">浏览次数：{{item.click}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default{
		props:['list'],
		data(){
			return{
				
			}
		},
		onLoad(){
			
		},
		filters:{
			formatDate(date){
				const nDate = new Date(date);
				const year = nDate.getFullYear();
				const month = nDate.getMonth().toString().padStart(2,0);
				const day = nDate.getDate().toString().padStart(2,0);
				return year+"-"+month+"-"+day
			}
		},
		methods:{
			navigator(item){
				this.$emit('itemClick',item)
			}
		}
		
	}
</script>

<style>
	.news .news_item{
		display:flex;
		padding:15rpx 10rpx;
		border-bottom:1rpx solid #ededed;
	}
	.news .news_item  image{
		min-width:320rpx;
		max-width:320rpx;
		height:300rpx;
	}
	.news .right{
		margin:30rpx 0 28rpx 0;
		display:flex;
		flex-direction:column;
		justify-content:space-between;
		align-items: center;
	}
	.news .info{
		font-size:24rpx;
	}
	.news .info .text{
		margin-left:30rpx;
	}
	.news .tit{
		font-sie:30rpx;
		overflow:hidden;
		text-overflow:ellipsis;
		display:-webkit-box;
		-webkit-line-clamp:3;
		-webkit-box-orient:vertical;
	}
</style>